
<br>Note: Actual fields might be more than above count because some fields are internally defined at system level!<br>
<?php 
	$this->addScript("AJAX_Forms", $javascript->link('/effects/js/jquery.form.js'));
	$index->setData($entityFields, 'EntityField');
	$index->showFields(array('id', 'EavField.label','EntityField.order'));
	$index->setAction('Edit', array('action'=>'edit',':EntityField.id'),array('class'=>'action'));
	$index->setAction('Delete',array('action'=>'delete',':EntityField.id'),array(),sprintf(__('Are you sure you want to delete %s #%s ',true),'Field',':EntityField.id'));
	echo $index->display(array('id'=>'entityFieldTable'));
?>
<br>
<?php echo $html->link(__('Add Field',true),array('action'=>'admin_add',$entity,$entityId))?>
<?php $html->addJUI();?>
<script type="text/javascript">
	$(document).ready(function(){
		$('#entityFieldTable > tbody').sortable({'items':'tr.inforow','stop':function(event,ui){
			var fieldId = [];
			$(this).children('tr.inforow').each(function(i){
					fieldId.push($(this).attr('id').split('_')[1]);
					$(this).children('td::eq(2)').text(i+1);
				});
				$.get("<?php echo $html->url(array('action'=>'admin_updateOrder',$entity,$entityId))?>/"+fieldId.join('|'));
				$(this).children('tr.inforow:even').addClass("altrow");
				$(this).children('tr.inforow:odd').removeClass("altrow");
			}});
	})
</script>
